home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / balloo1a / balloont.ctl < prev    next >
Text File  |  1999-08-31  |  6KB  |  232 lines

  1. VERSION 5.00
  2. Begin VB.UserControl BalloonTip 
  3.    ClientHeight    =   240
  4.    ClientLeft      =   0
  5.    ClientTop       =   0
  6.    ClientWidth     =   225
  7.    EditAtDesignTime=   -1  'True
  8.    InvisibleAtRuntime=   -1  'True
  9.    Picture         =   "BalloonTip.ctx":0000
  10.    ScaleHeight     =   16
  11.    ScaleMode       =   3  'Pixel
  12.    ScaleWidth      =   15
  13.    ToolboxBitmap   =   "BalloonTip.ctx":0102
  14.    Begin VB.Timer tmrCtrl 
  15.       Interval        =   1000
  16.       Left            =   360
  17.       Top             =   0
  18.    End
  19. End
  20. Attribute VB_Name = "BalloonTip"
  21. Attribute VB_GlobalNameSpace = False
  22. Attribute VB_Creatable = True
  23. Attribute VB_PredeclaredId = False
  24. Attribute VB_Exposed = True
  25. '----------------------------------------
  26. ' ________  Copyright EAguirre (c)1999
  27. '(        ) eaguirre@comtrade.com.mx
  28. '(  ______)
  29. ' \/
  30. ' BalloonToolTip
  31. '----------------------------------------
  32. Option Explicit
  33. 'User Defined Enumerators
  34. Enum WordBoolValue
  35.     No = 0
  36.     yes = 1
  37. End Enum
  38.  
  39. Enum TextAlignValue
  40.     Left = 0
  41.     Center = 1
  42.     Right = 2
  43. End Enum
  44.  
  45. Enum StyleValue
  46.     Rectangle = 0
  47.     Balloon = 1
  48.     Round_Rectangle = 2
  49. End Enum
  50.  
  51. Enum OrientationValues
  52.     North = 0
  53.     NE = 1
  54.     East = 2
  55.     SE = 3
  56.     South = 4
  57.     Sw = 5
  58.     West = 6
  59.     NW = 7
  60. End Enum
  61.  
  62. 'Default Property Values:
  63. Const m_def_AutoSize = yes
  64. Const m_def_TextAlign = Left
  65. Const m_def_WordBreak = yes
  66. Const m_def_Orientation = NE
  67. Const m_def_BackColor = &HFFFF&
  68. Const m_def_ForeColor = 0
  69. Const m_def_Text = " "
  70. Const m_def_Style = Balloon
  71.  
  72. 'Property Variables:
  73. Dim m_AutoSize As WordBoolValue
  74. Dim m_TextAlign As TextAlignValue
  75. Dim m_WordBreak As WordBoolValue
  76. Dim m_Orientation As OrientationValues
  77. Dim m_BackColor As OLE_COLOR
  78. Dim m_ForeColor As OLE_COLOR
  79. Dim m_Font As Font
  80. Dim m_Text As String
  81. Dim m_Style As Variant
  82. Dim m_init As Boolean
  83.  
  84. 'Properties
  85. Public Property Get BackColor() As OLE_COLOR
  86.     BackColor = m_BackColor
  87. End Property
  88. '
  89. Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
  90.     m_BackColor = New_BackColor
  91.     PropertyChanged "BackColor"
  92.     UserControl.BackColor = m_BackColor
  93. End Property
  94.  
  95. Public Property Get ForeColor() As OLE_COLOR
  96.     ForeColor = m_ForeColor
  97. End Property
  98.  
  99. Public Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR)
  100.     m_ForeColor = New_ForeColor
  101.     PropertyChanged "ForeColor"
  102.     UserControl.ForeColor = m_ForeColor
  103. End Property
  104.  
  105. Public Property Get Font() As Font
  106. Attribute Font.VB_UserMemId = -512
  107.     Set Font = m_Font
  108. End Property
  109.  
  110. Public Property Set Font(ByVal New_Font As Font)
  111.     Set m_Font = New_Font
  112.     PropertyChanged "Font"
  113.     Set UserControl.Font = m_Font
  114. End Property
  115.  
  116. Public Property Get Text() As String
  117.     Text = m_Text
  118. End Property
  119.  
  120. Public Property Let Text(ByVal New_Text As String)
  121.     m_Text = New_Text
  122.     PropertyChanged "Text"
  123.    
  124. End Property
  125.  
  126. Public Property Get Style() As StyleValue
  127.     Style = m_Style
  128. End Property
  129.  
  130. Public Property Let Style(ByVal new_Style As StyleValue)
  131.     m_Style = new_Style
  132.     PropertyChanged "Style"
  133. End Property
  134.  
  135. Public Property Get Orientation() As OrientationValues
  136.     Orientation = m_Orientation
  137. End Property
  138.  
  139. Public Property Let Orientation(ByVal New_Orientation As OrientationValues)
  140.     m_Orientation = New_Orientation
  141.     PropertyChanged "Orientation"
  142. End Property
  143.  
  144. Public Property Get TextAlign() As TextAlignValue
  145.     TextAlign = m_TextAlign
  146. End Property
  147.  
  148. Public Property Let TextAlign(ByVal New_TextAlign As TextAlignValue)
  149.     m_TextAlign = New_TextAlign
  150.     PropertyChanged "TextAlign"
  151. End Property
  152.  
  153. Public Property Get WordBreak() As WordBoolValue
  154.     WordBreak = m_WordBreak
  155. End Property
  156.  
  157. Public Property Let WordBreak(ByVal New_WordBreak As WordBoolValue)
  158.     m_WordBreak = New_WordBreak
  159.     PropertyChanged "WordBreak"
  160. End Property
  161.  
  162. Public Property Get AutoSize() As WordBoolValue
  163.     AutoSize = m_AutoSize
  164. End Property
  165.  
  166. Public Property Let AutoSize(ByVal New_AutoSize As WordBoolValue)
  167.     m_AutoSize = New_AutoSize
  168.     PropertyChanged "AutoSize"
  169. End Property
  170.  
  171. Private Sub tmrCtrl_Timer()
  172. 'Initialize the control, because when the initialize method
  173. 'fires before the control is loaded
  174.   If Not (UserControl.Parent Is Nothing) Then
  175.     'Init Procedure (Hooking the window)
  176.     InitProc UserControl.Parent
  177.     tmrCtrl.Interval = 0
  178.     tmrCtrl.Enabled = False
  179.   End If
  180. End Sub
  181.  
  182. Private Sub UserControl_Resize()
  183. 'Keep short
  184. Width = 240
  185. Height = 240
  186. End Sub
  187.  
  188. Private Sub UserControl_Terminate()
  189.     TerminateProc
  190. End Sub
  191.  
  192. 'Initialize Properties for User Control
  193. Private Sub UserControl_InitProperties()
  194.     m_BackColor = m_def_BackColor
  195.     m_ForeColor = m_def_ForeColor
  196.     Set m_Font = Ambient.Font
  197.     m_Text = m_def_Text
  198.     m_Style = m_def_Style
  199.     m_Orientation = m_def_Orientation
  200.     m_TextAlign = m_def_TextAlign
  201.     m_WordBreak = m_def_WordBreak
  202.     m_AutoSize = m_def_AutoSize
  203.     m_init = False
  204. End Sub
  205.  
  206. 'Load property values from storage
  207. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  208.     m_BackColor = PropBag.ReadProperty("BackColor", m_def_BackColor)
  209.     m_ForeColor = PropBag.ReadProperty("ForeColor", m_def_ForeColor)
  210.     Set m_Font = PropBag.ReadProperty("Font", Ambient.Font)
  211.     m_Text = PropBag.ReadProperty("Text", m_def_Text)
  212.     m_Style = PropBag.ReadProperty("Style", m_def_Style)
  213.     m_Orientation = PropBag.ReadProperty("Orientation", m_def_Orientation)
  214.     m_TextAlign = PropBag.ReadProperty("TextAlign", m_def_TextAlign)
  215.     m_WordBreak = PropBag.ReadProperty("WordBreak", m_def_WordBreak)
  216.     m_AutoSize = PropBag.ReadProperty("AutoSize", m_def_AutoSize)
  217. End Sub
  218.  
  219. 'Write property values to storage
  220. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  221.     Call PropBag.WriteProperty("BackColor", m_BackColor, m_def_BackColor)
  222.     Call PropBag.WriteProperty("ForeColor", m_ForeColor, m_def_ForeColor)
  223.     Call PropBag.WriteProperty("Font", m_Font, Ambient.Font)
  224.     Call PropBag.WriteProperty("Text", m_Text, m_def_Text)
  225.     Call PropBag.WriteProperty("Style", m_Style, m_def_Style)
  226.     Call PropBag.WriteProperty("Orientation", m_Orientation, m_def_Orientation)
  227.     Call PropBag.WriteProperty("TextAlign", m_TextAlign, m_def_TextAlign)
  228.     Call PropBag.WriteProperty("WordBreak", m_WordBreak, m_def_WordBreak)
  229.     Call PropBag.WriteProperty("AutoSize", m_AutoSize, m_def_AutoSize)
  230. End Sub
  231.  
  232.